package com.lesama.test;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Scanner;

public class DateTest1 {
    public static void main(String[] args) {

        Scanner sc = new Scanner(System.in);
        System.out.println("请输入你的生日：  xxxx年xx月xx日");
        String birthday = sc.next();
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy年MM月dd日");
        try {
            Date parse = simpleDateFormat.parse(birthday);
            System.out.println("您已经来到这个世界上有" + (new Date().getTime() - parse.getTime()) / 1000 / 60 / 60 / 24 + "天了");
        } catch (ParseException e) {
            throw new RuntimeException(e);
        }

    }
}
